import {baseAjax} from '../baseAjax'
import {exportData} from './commom'

// 获取企业详情
export function getEnterpriseDetail (url, data, type, success, error) {
  baseAjax(url, data, type, success, error)
}

// 批量保存
export function batchSave (data, success, error) {
  baseAjax('/ent/customer/batch/save', data, 'post', success, error)
}
// 批量保存
export function cooperationBatchSave (data, success, error) {
  baseAjax('/ent/customer/cooperation/batch/save', data, 'post', success, error)
}

// 数据导出
export function customerExport (data, fileName) {
  exportData('/ent/customer/export', data, fileName)
}

// 标记重点客户
export function markMainly (idList, successHandle, failHandle) {
  let _url = '/ent/customer/mainly/' + idList
  baseAjax(_url, {}, 'put', successHandle, failHandle)
}

// 取消标记重点客户
export function unmarkMainly (idList, successHandle, failHandle) {
  let _url = '/ent/customer/mainly/cancel/' + idList
  baseAjax(_url, {}, 'put', successHandle, failHandle)
}

// 批量转让
export function transferCustomerBatch (data, successHandle, failHandle) {
  baseAjax('/ent/customer/transfer', data, 'put', successHandle, failHandle)
}

// 移除客户
export function removeCustomer (id, successHandle, failHandle) {
  let _url = '/ent/customer/flow/remove/' + id
  baseAjax(_url, {}, 'put', successHandle, failHandle)
}

// 合作记录类型
export const incomeType = [{id: 1, name: '进款'}, {id: 2, name: '退款'}, {id: 3, name: '挂靠'}]
